package com.example.g2daylx2.video

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.g2daylx2.R
import com.example.g2daylx2.adapter.VideoAdaptre
import com.example.g2daylx2.databinding.ActivityVideoBinding
import com.example.lib_base.net.mvvm.BaseActivity

class VideoActivity : com.example.g2daylx2.BaseActivity<ActivityVideoBinding,VideoViewModel>() {
    lateinit var videoAdapter:VideoAdaptre
    override fun initView() {
        videoAdapter = VideoAdaptre()
        binding.rv.adapter = videoAdapter
        binding.rv.layoutManager = LinearLayoutManager(this)
        viewModel.video(10,1)
    }

    override fun initData() {
        viewModel.videoSuccess.observe(this){
            videoAdapter.data.clear()
            videoAdapter.data.addAll(it.data.list)
            videoAdapter.notifyDataSetChanged()
        }
    }

    override fun getViewModel(): Class<VideoViewModel> {
       return VideoViewModel::class.java
    }

    override fun getLayout(): Int {
        return R.layout.activity_video
    }


}